package com.zzc.qqchat.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;

public interface AddFriendsListRep extends JpaRepository<AddFriendsList,Integer> {

    @Query(value = "select * from apply  where receiver_Id=?1",nativeQuery = true)
    ArrayList<AddFriendsList> findByReceiverId(int receiverId);

    @Modifying
    @Transactional
    @Query(value = "delete from apply where receiver_Id=?1 and sender_Id=?2",nativeQuery = true)
    int deleteByReceAndSenderId(int receiverId,int senderId);
}
